<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ include file="/FInclude/includeTaglibs.jsp"%>
<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
<link rel="stylesheet" href="${frontPath}/style/ckeditor.plugin.css" />
<c:import url="/FInclude/backEndCssJs.jsp" />
<script type="text/javascript"
	src="${frontPath}/js/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="${frontPath}/js/ckeditor.plugin.js"></script>
<script src="${frontPath}/js/DatePicker/WdatePicker.js"></script>
</head>
<body>
<div>新增根部门</div>
	<form action="add.json" method="post" onsubmit="return false;">
	<div class="container-fluid">
		<div class="panel panel-default">
			<div class="row">
				<div class="input-group">
					<button class="form-control" onclick="history.back();">返回</button>
				</div>
				<div class="input-group">
					<span class="input-group-addon">名称</span>
					<input style="width:120px" name="name">
				</div>
				<div class="input-group">
					<span class="input-group-addon">英文名称</span>
					<input style="width:120px" name="e_name">
				</div>
				<div class="input-group">
					<span class="input-group-addon">图片</span>
					<img src="">
					<input type="file" style="width:80px" name="upload">
					<input name="pic" type="hidden" >
					<input type="hidden" name="parentId" value="0">
					<input type="hidden" name="isParent" value="1">
				</div>
				<div class="input-group">
					<input type="submit" class="form-control" a>
				</div>
			</div>
		</div>
	</div>
	</form>
	<script>
	$("input[type=file]").change(function(){
		var _this = $(this);
		$(this).uploadFile("../../file/image.json",{},function(data){
			_this.prev().attr("src", $.frontPath + data.url);
			_this.next().val(data.url);
		});
	});
	
	$("form [type=submit]").click(function(){
		var _this = $("form");
		_this.postData(
				_this.attr("action"),
				{},
				function(data){
					$.box("添加成功",function(){
						var a = parent.$("#leftTree").zTree.getZTreeObj("leftTree");
						a.addNodes(a.getSelectedNodes()[0], {name:data.type.name,isParent:0,id:data.type.typeId,pId:0});
					});
		});
	});
</script>
</body>
</html>